﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Pixysoft.Framework.Noebe.Core
{
    class ConnectionPoolPerformance
    {
        /** create next connection id */
        private int _nextConnectionId = 0;

        /** last reduce adjust pool times */
        private DateTime lastLazytime = DateTime.MinValue;

        /** total request times */
        private long totalRequestTimes = 0;

        /** total removed connection times. */
        private long totalRemovedTimes = 0;

        /** total removed requestd count of removed connection. */
        private long totalRemovedRequestTimes = 0;

        public int GetNextConnectionId()
        {
            return _nextConnectionId;
        }

        public int NextConnectionId()
        {
            return _nextConnectionId++;
        }

        public DateTime GetLastLazytime()
        {
            return lastLazytime;
        }

        public void SetLastLazytime(DateTime lastLazytime)
        {
            this.lastLazytime = lastLazytime;
        }

        public long GetTotalRequestTimes()
        {
            return totalRequestTimes;
        }

        public long IncreaseTotalRequestTimes()
        {
            return this.totalRequestTimes++;
        }

        public long GetTotalRemovedTimes()
        {
            return totalRemovedTimes;
        }

        public void IncreaseTotalRemovedTimes()
        {
            this.totalRemovedTimes++;
        }

        public long GetTotalRemovedRequestTimes()
        {
            return totalRemovedRequestTimes;
        }

        public void AddTotalRemovedRequestTimes(long totalRemovedRequestTimes)
        {
            this.totalRemovedRequestTimes += totalRemovedRequestTimes;
        }

    }
}
